//
//  KLCarSaleTableViewCell.m
//  KunLun
//
//  Created by Mac on 2017/11/27.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "KLTodayGoodTableViewCell.h"

@interface KLTodayGoodTableViewCell()
@property(nonatomic, strong) UIImageView                      *iconImageView;
@property(nonatomic, strong) STLabel                            *titleLable;
@property(nonatomic, strong) STLabel                            *desLable;//描述
@property(nonatomic, strong) STLabel                            *nowLable;//现价
@property(nonatomic, strong) STLabel                            *orginLable;//原价

@property(nonatomic, strong) STLabel                            *numLbale;//出售多少
@end
@implementation KLTodayGoodTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 125;
}
#pragma mark --subView
- (void)configSubView{
    
    self.backgroundColor = [UIColor whiteColor];
    
    self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, 100, 100)];
    self.iconImageView.image = [UIImage imageNamed:@"13"];
    self.iconImageView.clipsToBounds = YES;
    self.iconImageView.contentMode = UIViewContentModeScaleAspectFill;
    [self addSubview:self.iconImageView];
    
    self.titleLable = [[STLabel alloc] initWithFrame:CGRectMake(self.iconImageView.right + 10, self.iconImageView.top + 5, UIScreenWidth - self.iconImageView.right - 20, 20)
                                                text:@"长安铃木"
                                           textColor:KL_firstTextColor
                                                font:15
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.titleLable];
    
    self.desLable = [[STLabel alloc] initWithFrame:CGRectMake(self.iconImageView.right + 10, self.titleLable.bottom +3, UIScreenWidth - self.iconImageView.right - 20, 40)
                                              text:@"dasdasdas三大范德萨范德萨都是范德萨范德萨佛挡杀佛 是的范德萨"
                                         textColor:KL_secendTextColor
                                              font:14
                                       isSizetoFit:NO
                                     textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.desLable];
    
    self.nowLable = [[STLabel alloc] initWithFrame:CGRectMake(self.iconImageView.right + 10, self.desLable.bottom + 3, 80, 20)
                                                text:@"$455"
                                           textColor:KL_redColor
                                                font:14
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.nowLable];
    
    self.orginLable = [[STLabel alloc] initWithFrame:CGRectMake(self.nowLable.right + 10, self.desLable.bottom + 3, UIScreenWidth - self.nowLable.right - 20, 20)
                                              text:@"$455"
                                         textColor:KL_secendTextColor
                                              font:14
                                       isSizetoFit:NO
                                     textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.orginLable];
    
    
    self.numLbale = [[STLabel alloc] initWithFrame:CGRectMake(self.iconImageView.right + 10, self.orginLable.bottom + 3, UIScreenWidth - self.iconImageView.right - 20, 20)
                                              text:@"联系方式：18380461887"
                                         textColor:KL_secendTextColor
                                              font:14
                                       isSizetoFit:NO
                                     textAlignment:NSTextAlignmentRight];
    self.numLbale.right = UIScreenWidth - 10;
    self.numLbale.hidden = YES;
    [self addSubview:self.numLbale];
}
- (void)setGoodModel:(KLTodayGoodModel *)goodModel{
    _goodModel = goodModel;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:goodModel.exhibition_map]];
    
    self.titleLable.text = _goodModel.goods_name;
    
    self.desLable.text = goodModel.abstract;
    
    self.nowLable.text = [NSString stringWithFormat:@"￥%@",goodModel.discount_price];
    [NSString lableAutoAdjustWitdhWithLabel:self.nowLable];
    
    self.orginLable.left = self.nowLable.right + 5;
    self.orginLable.text = [NSString stringWithFormat:@"原价:￥%@",goodModel.price];
    
    self.numLbale.text =  [NSString stringWithFormat:@"已售出:%@    库存:%@",
                           goodModel.sell_num.description,
                           goodModel.stock.description];
    
}

@end

